<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
    <div>1. 基本使用: {{ $store.state.count }}</div>
    <div>2. 计算属性: {{ num }}</div>
    <div>3. 辅助函数: {{ count }} -- {{ username }}</div>
    <hr>

    <!-- <child-a></child-a> -->

    <child-b></child-b>
  </div>
</template>

<script>
import { mapState } from 'vuex'
// import ChildA from '@/components/child-a'

import ChildB from '@/components/child-b'

export default {
  name: 'App',
  components: {
    // ChildA,
    ChildB
  },
  computed: {
    ...mapState(['count', 'username']),
    num() {
      return this.$store.state.count
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
